Test Failed
Push — develop ( 424bfb...c8c23d )
by Endre
02:45
created

Application   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 20
dl 0
loc 24
c 0
b 0
f 0
rs 10
ccs 2
cts 2
cp 1

3 Functions

Rating   Name   Duplication   Size   Complexity  
A render 0 5 1
A componentDidMount 0 3 1
A onLanguageLoaded 0 3 1
1
import React from 'react';
2
import {ILanguageSetup} from '../Language/ChangeLanguageSetup';
3
import Container from './Container';
4
import ApplicationModel from './Model/ApplicationModel';
5
import ApplicationView from './View/ApplicationView';
6
7
interface IProperties {
8
}
9
10
interface IState {
11
  loadedLanguage: string
12
}
13
14 1
export default class Application extends React.Component<IProperties, IState> {
15
  constructor(props: IProperties) {
16 1
    super(props);
17
18
    this.state = {
19
      loadedLanguage: ''
20
    };
21
22
    Container.language.setupAdapter.addListener(this.onLanguageLoaded.bind(this));
23
  }
24
25
  componentDidMount(): void {
26
    Container.language.changeLanguageSetup.interact({languageCode: 'de-de'}, {}).then();
27
  }
28
29
  onLanguageLoaded(oldValue: ILanguageSetup, newValue: ILanguageSetup) {
30
    this.setState({loadedLanguage: newValue.languageCode})
31
  }
32
33
  render(): React.ReactNode {
34
    const model: ApplicationModel = Container.applicationPresenter.present('Application');
35
36
    return <ApplicationView model={model} />
37
  }
38
}